	@include("user.head")
	<div id="content_person">
		<div class="row">
			<div class="col-xs-3">
				@include('user.uc.navigation')
			</div>
			<div class="col-xs-9">
				<div class="panel panel-default">
				  <div class="panel-heading">
				    <h3 class="panel-title">编辑资讯信息</h3>
				  </div>
				  <div class="panel-body">
				  	<div class="form-horizontal">
						<div class="form-group">
							<label for="inputNick" class="col-xs-3 control-label no_padding_right">资讯标题:</label>
							<div class="col-xs-6">
								<input class="form-control" value="<%$data['title']%>" name="title" id="inputNick" placeholder="" type="text">
								<span class="hint">
						        	<i class="fa fa-check-circle"></i> <span class="msg"></span>
						        </span>
							</div>
						</div>
						<div class="form-group">
					      <label class="col-xs-3 control-label no_padding_right">新闻类型:</label>
					      <div class="col-xs-9">
					        <div class="radio">
					          <label>
					            <input name="type" id="" value="0" @if($data['type'] == 0) checked="" @endif type="radio">
					            资讯新闻
					          </label>
					          <label>
					            <input name="type" id="" value="1" @if($data['type'] == 1) checked="" @endif type="radio">
					            开发区
					          </label>
					          <label>
					            <input name="type" id="" value="2" @if($data['type'] == 2) checked="" @endif type="radio">
					            机构与业绩
					          </label>
					          <label>
					            <input name="type" id="" value="3" @if($data['type'] == 3) checked="" @endif type="radio">
					            碳排放资讯
					          </label>
					        </div>
					      </div>
					    </div>
				    	<div class="form-group">
				          <label for="textArea" class="col-xs-3 control-label no_padding_right">资讯简介:</label>
				          <div class="col-xs-6">
				            <textarea class="form-control text_size" name="description" rows="3" id="textArea"><%$data['description']%></textarea>
				            <span class="help-block"></span>
				          </div>
				        </div>

				         <div class="form-group">
				          <label for="inputEmail" class="col-xs-3 control-label no_padding_right">资讯图片:</label>
				          <div class="col-xs-6">
				            <a href="javascript:;" class="file btn btn-primary">上传
				                <input type="file" name="imgFile" id="newsImg">
				                <input type="hidden" value="<%$data['image_name']%>" class="hiddenName" name="image_name">
				            </a>
				          </div>
				        </div>

			        	<div class="form-group">
			              <label for="textArea" class="col-xs-3 control-label no_padding_right">资讯正文:</label>
			              <div class="col-xs-9">
			                <div id="container" name="content" style="height:500px;"></div>
			              </div>
			            </div>
					    <div class="row">
					    	<div class="col-xs-12 text-center">
						      	<input type="hidden" value="<%$data['id']%>" name="nid">
						        <button type="botton" id="saveBtn" class="btn btn-primary">保存修改</button>
					      	</div>
					    </div>
					</div>
				  </div>
				</div>
			</div>
		</div>
	</div>
	<!-- 公共底部 -->
	@include("user.footer")
	@include("user.common")
	<!-- 公共底部 -->
</body>
<script type="text/javascript">
var ue = UE.getEditor('container');

ue.ready(function(){
    ue.setContent(decodeURIComponent("<%$data['content']%>"));
});

$('#newsImg').AjaxFileUpload({
	path : "<% url('uc/user/upload') %>",
	onComplete : function(filename){
			$(this).siblings('input[class="hiddenName"]').val(filename.filename);
		}
	});

$("#saveBtn").click(function(){

	var title 	= $("input[name='title']").val().trim();
	var description = $("textarea[name='description']").val();
	var type 	= $("input[name=type]:checked").val();
	var content = encodeURIComponent(ue.getContent());
	var image_name = $("input[name='image_name']").val().trim();
	var nid = $("input[name='nid']").val();
	if(title == '' || type == '' || content == ''){
		warning("", "标题和正文内容不能为空");
	}
	$.post("edit_news/update", {
		title : title,
		description : description,
		type : type,
		content : content,
		image_name : image_name,
		nid : nid
	}, function(data){
		if(data.success){
			success('', '提交成功');
			setTimeout(function(){
				window.location.reload();
			},2000);
		}
	})
})
</script>
</html>